package com.example.cuibo.basicarray;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * Created by cuibo on 2017/10/31.
 */

public class Demo1_Array {

    public static void main(String[] args){
        Student[] arr = new Student[5];
        arr[0] = new Student("崔博",3);
        arr[1] = new Student("崔博",3);
        arr[2] = new Student("崔博",3);
        arr[3] = new Student("崔博",3);
        arr[4] = new Student("崔博",3);

        for (int i = 0; i < arr.length; i++){
            System.out.print(arr[i]);
        }
        Collection coll = new ArrayList();
        coll.add("a");
        coll.add("b");
        coll.add("c");
//        Object[] arr1 = coll.toArray(); // 集合转化成数组  就可以遍历
//        for (int x = 0, x < arr1.length, x++){
//            System.out.print(arr[x]);
//        }
        coll.add(new Student("11",12));
        coll.add(new Student("13",12));
        coll.add(new Student("15",12));
        coll.add(new Student("16",12));


        Iterator it = coll.iterator();
        while (it.hasNext()){   // 集合中的遍历
            System.out.print(it.next());
        }


    }



}
